<template>
  <view class="page">
    <view class="box" v-for="(item,index) in list" :key="index">
        <view class="box-con">
            <view class="box-title">{{ withdrawal_type[item.withdrawal_type] }}</view>
            <view class="item">
                到账方式
                <span>{{ withdrawal_way[item.withdrawal_way] }}</span>
            </view>
            <view class="item">
                提现金额
                <span>￥{{ item.withdrawal_price }}</span>
            </view>
            <view class="item">
                提现时间
                <span>{{ item.created_at }}</span>
            </view>
            <view class="item">
                提现状态
                <span style="color: #FFBB50;">{{ withdrawal_status[item.status] }}</span>
            </view>
        </view>
    </view>
    <view class="kong"></view>
  </view>
</template>
<script>
import { withdrawalhistory } from "@/utils/request.js";
export default {
  data() {
    return {
        query:{
            p:0,
            n:10
        },
        list:[],
        count:0,
        withdrawal_type:{},
        withdrawal_status:{},
        withdrawal_way:{}
    };
  },
  onLoad(){
    this.getInit()
  },
  onReachBottom(){
    if(this.list.length<this.count){
        this.query.n++
        this.getInit()
    }
  },
  methods:{
    async withdrawalhistory(data) {
      return withdrawalhistory(data)
    },
    getInit(){
        this.withdrawalhistory(this.query).then(res=>{
            console.log(res)
            if(res){
                this.count=res.count
                this.list=[...res.list,...this.list]
                this.withdrawal_status=res.withdrawal_status
                this.withdrawal_type=res.withdrawal_type
                this.withdrawal_way=res.withdrawal_way
            }
        })
    },
  }
};
</script>
<style lang="scss" scoped>
.page{
    padding: 16rpx 0;
}
.box{
    width: 694rpx;
    border-radius: 12rpx;
    background: #ffffff;
    margin:0 auto 16rpx;
    .box-con{
        width: 92%;
        margin: 0 auto;
        .box-title{
            font-size: 24rpx;
            color: #333333;
            padding: 16rpx 0;
        }
        .item{
            padding: 16rpx 0;
            font-size: 24rpx;
            color: #7F7F7F;
            span{
                color: #333333;
                margin-left: 12rpx;
            }
        }
    }
}
</style>